#ifndef CSTATEGRAVEYARD_H_INCLUDED
#define CSTATEGRAVEYARD_H_INCLUDED

#include <map>

#include "CState.h"

class CMinion;
class CMinionInfoPanel;
struct MinionStat;

class CStateGraveyard : public CState
{
  public:
    CStateGraveyard(CGameManager * mgr);
    virtual ~CStateGraveyard();

    void init();
    void close();
    void run();
    void enable();
    void disable();

    //! Event Receiving Methods

    void OnServerPacketReceived(Packet *packet);

    void OnClientPacketReceived(Packet *packet);

    //! Called when mouse is clicked
    bool OnMouseClick();

    //! Called when a GUI button
    bool OnButtonClick(s32 id);

    //! Called when other GUI events happens
    virtual bool OnGUIEvent(const SEvent& event);

    void addMinionPanel(CMinion *pMinion, u8 i=3);

    void showMinionWindow();

    //! Network Request and Replies methods
    void requestAddMinion();

    void requestRemoveMinion();

    void addMinion(BitStream *bs);

    void removeMinion(BitStream *bs);


  protected:
  private:
    IGUITab * parent;
    IGUIStaticText *chosen;
    IGUIWindow *minionWindow;
    IGUIEditBox *txtMinionName;
    IGUIComboBox* comMinionType;

    IGUIListBox *lstMinion;

    CMinionInfoPanel *infoPanel;

    vector <IGUIStaticText*> vMinionPanel;

    std::map <int, MinionStat> minion_base;

    enum GUI_ID
    {
      BTN_POPSTATE,
      BTN_BUY_MINION,
      BTN_SELL_MINION,
      BTN_BUY_OK,
      BTN_BUY_CANCEL,

      LST_MINION,

      PANEL_MINION,
    };
};

#endif // CSTATEGRAVEYARD_H_INCLUDED
